//#define MODEL3D
bool NON_HEIGHT_FIELD = false;	// FLAG TO TURN ON/OFF NON-HEIGHT FIELD RELIEF MAPPING

bool changed = false, 
	 sceneRotate = false,		// FLAG TO TURN ON/OFF ROTATION OF SCENE
	 move_light = false;		// FLAG TO TURN ON/OFF ROTATION OF LIGHT

float theta = 0,				/* ORIENTATION OF THE SURFACE */
	  phi=-45;

float light_theta = 45,			/* ORIENTATION OF LIGHT */
	  light_phi = 45;

int iterations = 50, 
    dmap_depth,					// DEPTH OF DISTANCE MAP
	screen_width=512,			// WIDTH OF SCREEN
	screen_height=512,			// HEIGHT OF SCREEN 
	whichFragment;				// TO SELECT WHICH FRAGMENT PROGRAM TO LOAD

int buttons[5] = {	
					GLUT_UP, 
					GLUT_UP, 
					GLUT_UP, 
					GLUT_UP, 
					GLUT_UP
				};
int cur_x,						// CURRENT POSITION OF MOUSE CLICK
	cur_y;

int	textureDepth,				// DEPTH OF TEXTURE
	textureLength,				// LENGTH OF TEXTURE
	textureWidth,				// WIDTH OF TEXTURE
	LEVELS,						// NUMBER OF LEVES OF MIPMAP HEIGHT MAP
	tileResolution = 1;			// CONTROLS SUBDIVISION OF SURFACE

float bumpdepth = 0.8;			
float eyePosition[4] = { 120, 250.0, 1700.0, 1 };// POSITION OF EYE
float objectPosition[4] = { 0.0, 0.0, 0.0, 1 };	 // POSITION OF SURFACE
float lightPosition[4] = { 0.0, 100.0, 0.0, 1 }; // POSITION OF LIGHT

static float myProjectionMatrix[16];			/* TRANSFORMATION MATRICES */
float	translateMatrix[16], 
		rotateMatrix[16],
		modelMatrix[16], 
		invModelMatrix[16], 
		viewMatrix[16],
		modelViewMatrix[16], 
		modelViewProjMatrix[16];


GLuint myDtex,  // 3D texture					/* GL parameters */
	   ctex,	// 2D texture
	   ntex,    // 2D texture
	   ntexY,	// 2D texture
	   htex,	// 2D texture
	   mmtex;	// 2D texture


float keyPressed = 0.0;
float MAXIMUM_DIMENSION;

GLMmodel *model1;


static CGcontext myCgContext;					/* CG VARIABLES */
static CGprofile myCgVertexProfile,
				 myCgFragmentProfile;

static CGprogram myCgVertexProgram,
				 myCgFragmentProgram,
				 myCgFragmentProgram1,
				 myCgFragmentProgram2,
				 myCgFragmentProgram3,
				 myCgFragmentProgram4,
				 myCgFragmentProgram5
				;

static CGparameter myCgModelViewProjection, 
				   myCgEyeCoordinate, 
				   myCgLightCoordinate, 
				   myCgInvBumpDepth,

				   myCgColorTexture, 
				   myCgHeightTexture, 
				   myCgNormalTexture,
				   myCgNormalTextureY,
				   myCgMipMapTex,

				   myCgDistanceTexture,

				   myCgNormalizationFactor,
				   myCgNumIterations,
				   myCgMaximumResolution,

				   myCgXrepeat,
				   myCgYrepeat,
				   myCgZrepeat,

				   myZreject
;
